home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000110_icon-group-sender _Thu May 20 14:37:07 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
2KB
Received: from owl.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 21 May 1993 10:50:18 MST
Received: by owl.cs.arizona.edu; Fri, 21 May 1993 10:50:17 MST
Date: 20 May 93 14:37:07 GMT
From: agate!spool.mu.edu!uwm.edu!msuinfo!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz)
Organization: University of Chicago
Subject: Re: A bug? Or a feature?
Message-Id: <1993May20.143707.20031@midway.uchicago.edu>
References: <12743@sun13.scri.fsu.edu>, <26810@ksr.com>
Sender: icon-group-request@cs.arizona.edu
To: icon-group@cs.arizona.edu
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
In article <26810@ksr.com> tim@ksr.com (Tim Peters) writes, regarding
the form X1 op:= X2:
>There's another (well, at least one more) ambiguity in the text you
>quote, to wit how many times X1 is evaluated. An example to show the
>difference:
> pick() +:= 10
> pick() := pick() + 10
>
>procedure pick()
> static i
> initial i := 0
> case i +:= 1 of {
> 1 : return i1
> 2 : return i2
> }
>end
...
>The point is that the left-hand side is evaluated exactly once in an
>augmented assignment, & I'm not sure The Bible ever says that except for
>an implication on pg 74...
Another good point. What Icon does is invoke the function pick(), and
when its value returns (at which point it is on the top of the stack),
it simply duplicates that value. That value is a variable. The value
is duplicated so it can be used once for assignment and once for ad-
dition. Pick() is invoked once, in other words - like Tim says.
I can imagine unpleasant side-effects if things didn't work this way.
--
-Richard L. Goerwitz goer%midway@uchicago.bitnet
goer@midway.uchicago.edu rutgers!oddjob!ellis!goer